var http = require('../http.js')

// 首页统计数据、图片
const statistic = () => {
  var url = 'common/statistic'
  return http.getReq(url)
}
// 获取类别
// shop：商户类别 info: 咨询 circle：动态类别
const category = (type) => {
  var url = 'common/category'
  return http.getReq(url, {
    type: type
  })
}

//动态列表 页码、类型、经度、纬度、用户id  获取某一类的动态

const list = (pn, type, longitude, latitude, cat_id, keyword, userid) => {
  var url = 'circle/list'
  if (pn > 1) {
    http.config.isload = false
  }

  var data = {}
  switch (type) {
    case 'is_recommend':
      data = {
        is_recommend: 1
      }
      break;
    case 'care':
      data = {
        care: 1
      }
      break;
    case 'hot':
      data = {
        hot: 1
      }
      break;
    case 'near':
      data = {
        near: 1,

      }
      break;
    default:
      data = {
        user_id: userid
      }
      break;
  }
  data = Object.assign(data, {
    pn: pn,
    longitude: longitude,
    latitude: latitude,
    cat_id: cat_id,
    keyword: keyword
  })
  return http.getReq(url, data)
}

// 添加关注
const care = (care_user_id, status) => {
  var url = 'user/care'
  return http.getReq(url, {
    care_user_id: care_user_id,
    status,
  })
}
//circle/users

const circle_users = (pn) => {
  var url = 'circle/users'
  return http.getReq(url, {
    pn,
  })
}
// 系统公告列表
const notices = () => {
  var url = 'notices/index'
  return http.getReq(url,{
    
  })
}
module.exports = {
  statistic,
  category,
  list,
  care,
  notices,
  circle_users,
}